package com.corejava.training.collections.car.pre15;
import java.util.*;

public class SchoolMutableDemo {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		// create 3 instances of class
		SchoolMutable school1 = new SchoolMutable();
		school1.setCity("westlake");
		school1.setGreatSchoolRanking(5);
		school1.setName("Basset");
		school1.setSchoolDistric("Main District");
		
		SchoolMutable school2 = new SchoolMutable();
		school2.setCity("fairfax");
		school2.setGreatSchoolRanking(2);
		school2.setName("Mosby");
		school2.setSchoolDistric("Fairfx District");
		
		SchoolMutable school3 = new SchoolMutable();
		school3.setCity("orlando");
		school3.setGreatSchoolRanking(8);
		school3.setName("Cathederal");
		school3.setSchoolDistric("City School District");
		
		// create a list and add instances to it
		List<SchoolMutable> simpleList = new ArrayList<SchoolMutable>();
		simpleList.add(school3);
		simpleList.add(school2);
		simpleList.add(school1);
		
		// iterate thru list , print them out with java 1.4 style
		Iterator ite = simpleList.iterator();
		while(ite.hasNext()){
			SchoolMutable sm = (SchoolMutable) ite.next();
			System.out.println("City: = " + sm.getCity());
			System.out.println("School rankings: = " + sm.getGreatSchoolRanking());
			System.out.println("Name: = " + sm.getName());
			System.out.println("School district: = " + sm.getSchoolDistric());
			System.out.println("--------------------------");
			
		}
		 
		// enhanced for loop, print out with java 1.5 style

	for (SchoolMutable sch : simpleList) {
		System.out.println("Start printing with jdk 1.5 style");
		System.out.println("City: = " + sch.getCity());
		System.out.println("School rankings: = " + sch.getGreatSchoolRanking());
		System.out.println("Name: = " + sch.getName());
		System.out.println("School district: = " + sch.getSchoolDistric());
		System.out.println("--------------------------");
	}
			
		}
		
		
	}


